<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>采购分析</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Microsoft YaHei', sans-serif;
        }

        body {
            background: linear-gradient(135deg, #0f1c3c 0%, #1a2d5a 100%);
            color: #e0e0e0;
            min-height: 100vh;
            padding: 10px;
        }

        .procurement-container {
            max-width: 1400px;
            margin: 0 auto;
        }

        /* 顶部筛选和数据概览区域 */
        .top-section {
            display: grid;
            grid-template-columns: 2fr 1fr;
            gap: 15px;
            margin-bottom: 20px;
        }

        /* 筛选区域样式 */
        .filter-section {
            background: rgba(22, 40, 75, 0.7);
            border-radius: 10px;
            padding: 15px;
            border: 1px solid #2a4a7c;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .filter-title {
            color: #4fc3f7;
            font-size: 1.1rem;
            margin-bottom: 12px;
            display: flex;
            align-items: center;
        }

        .filter-title i {
            margin-right: 8px;
        }

        .filter-grid {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
        }

        .filter-label {
            color: #81d4fa;
            margin-bottom: 5px;
            font-size: 0.85rem;
        }

        .filter-select {
            padding: 6px 10px;
            background: rgba(30, 60, 114, 0.7);
            border: 1px solid #3a5f9a;
            border-radius: 6px;
            color: #e0e0e0;
            font-size: 0.85rem;
        }

        .filter-actions {
            display: flex;
            justify-content: space-between;
            align-items: end;
            margin-top: 10px;
        }

        .year-filter {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .year-label {
            color: #81d4fa;
            font-size: 0.85rem;
            white-space: nowrap;
        }

        .year-select {
            padding: 6px 10px;
            background: rgba(30, 60, 114, 0.7);
            border: 1px solid #3a5f9a;
            border-radius: 6px;
            color: #e0e0e0;
            font-size: 0.85rem;
            min-width: 100px;
        }

        .query-btn {
            background: linear-gradient(90deg, #4fc3f7, #1976d2);
            color: white;
            border: none;
            padding: 8px 20px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 500;
            transition: all 0.3s ease;
            white-space: nowrap;
        }

        .query-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(79, 195, 247, 0.3);
        }

        /* 数据概览样式 - 2x2布局 */
        .data-overview {
            display: grid;
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
            gap: 10px;
            height: 100%;
        }

        .overview-card {
            background: rgba(22, 40, 75, 0.7);
            border-radius: 8px;
            padding: 15px;
            text-align: center;
            border: 1px solid #2a4a7c;
            transition: all 0.3s ease;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .overview-card:hover {
            transform: translateY(-3px);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
            border-color: #4fc3f7;
        }

        .overview-title {
            color: #81d4fa;
            font-size: 0.85rem;
            margin-bottom: 8px;
        }

        .overview-value {
            color: #4fc3f7;
            font-size: 1.4rem;
            font-weight: 700;
            margin-bottom: 3px;
            text-shadow: 0 0 8px rgba(79, 195, 247, 0.3);
            display: flex;
            align-items: baseline;
            justify-content: center;
            gap: 5px;
        }

        .overview-unit {
            color: #bbdefb;
            font-size: 0.9rem;
        }

        /* 结果描述样式 */
        .result-description {
            background: rgba(22, 40, 75, 0.5);
            border-radius: 8px;
            padding: 12px 15px;
            margin-bottom: 15px;
            border-left: 4px solid #4fc3f7;
            font-size: 0.9rem;
            line-height: 1.4;
        }

        .highlight {
            color: #4fc3f7;
            font-weight: 600;
        }

        /* 表格区域样式 */
        .table-section {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 15px;
        }

        .table-container {
            background: rgba(22, 40, 75, 0.7);
            border-radius: 10px;
            padding: 15px;
            border: 1px solid #2a4a7c;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .table-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 12px;
        }

        .table-title {
            color: #4fc3f7;
            font-size: 1rem;
            font-weight: 600;
        }

        .table-tabs {
            display: flex;
            background: rgba(30, 60, 114, 0.5);
            border-radius: 6px;
            padding: 3px;
        }

        .tab-btn {
            padding: 5px 10px;
            background: transparent;
            border: none;
            color: #bbdefb;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.8rem;
            transition: all 0.3s ease;
        }

        .tab-btn.active {
            background: #1976d2;
            color: white;
        }

        .data-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.85rem;
        }

        .data-table th {
            background: rgba(30, 60, 114, 0.7);
            color: #4fc3f7;
            padding: 10px 12px;
            text-align: left;
            font-weight: 600;
            border-bottom: 1px solid #2a4a7c;
        }

        .data-table td {
            padding: 10px 12px;
            border-bottom: 1px solid rgba(42, 74, 124, 0.5);
            color: #e0e0e0;
        }

        .data-table tr:hover {
            background: rgba(56, 107, 201, 0.2);
        }

        /* 图表区域样式 */
        .charts-section {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
        }

        .chart-container {
            background: rgba(22, 40, 75, 0.7);
            border-radius: 10px;
            padding: 15px;
            border: 1px solid #2a4a7c;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            height: 280px;
            display: flex;
            flex-direction: column;
        }

        .chart-title {
            color: #81d4fa;
            font-size: 0.9rem;
            margin-bottom: 12px;
            text-align: center;
            font-weight: 600;
            height: 2.2em;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .chart-placeholder {
            flex: 1;
            background: linear-gradient(45deg, #1a3a6b, #2a4a7c);
            border-radius: 6px;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #bbdefb;
            font-size: 0.9rem;
            text-align: center;
            padding: 10px;
        }

        /* 响应式设计 */
        @media (max-width: 1200px) {
            .top-section {
                grid-template-columns: 1fr;
            }

            .table-section {
                grid-template-columns: 1fr;
            }

            .charts-section {
                grid-template-columns: repeat(2, 1fr);
            }

            .filter-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .charts-section {
                grid-template-columns: 1fr;
            }

            .filter-grid {
                grid-template-columns: 1fr;
            }

            .data-overview {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
<div class="procurement-container">
    <!-- 顶部区域：筛选和数据概览 -->
    <div class="top-section">
        <!-- 筛选区域 -->
        <div class="filter-section">
            <div class="filter-title">
                <i class="fas fa-filter"></i>数据筛选条件
            </div>
            <div class="filter-grid">
                <div class="filter-group">
                    <label class="filter-label">采购级别</label>
                    <select class="filter-select" id="procurement-level">
                        <option value="">全部级别</option>
                        <option value="一级">一级</option>
                        <option value="二级">二级</option>
                    </select>
                </div>
                <div class="filter-group">
                    <label class="filter-label">采购类型</label>
                    <select class="filter-select" id="procurement-type">
                        <option value="">全部类型</option>
                        <option value="工程">工程</option>
                        <option value="物资">物资</option>
                        <option value="服务">服务</option>
                    </select>
                </div>
                <div class="filter-group">
                    <label class="filter-label">企业类型</label>
                    <select class="filter-select" id="enterprise-type">
                        <option value="">全部类型</option>
                        <option value="生产">生产</option>
                        <option value="基建">基建</option>
                    </select>
                </div>
                <div class="filter-group">
                    <label class="filter-label">采购平台</label>
                    <select class="filter-select" id="procurement-platform">
                        <option value="">全部平台</option>
                        <option value="华能商城">华能商城</option>
                        <option value="其他">其他</option>
                    </select>
                </div>
                <div class="filter-group">
                    <label class="filter-label">采购方式</label>
                    <select class="filter-select" id="procurement-method">
                        <option value="">全部方式</option>
                        <optgroup label="招标">
                            <option value="公开招标">公开招标</option>
                            <option value="邀请招标">邀请招标</option>
                        </optgroup>
                        <optgroup label="非招标">
                            <option value="寻比采购">寻比采购</option>
                            <option value="谈判采购">谈判采购</option>
                            <option value="竞价采购">竞价采购</option>
                            <option value="直接采购">直接采购</option>
                        </optgroup>
                    </select>
                </div>
                <div class="filter-group">
                    <label class="filter-label">年份</label>
                    <select class="filter-select" id="year-select">
                        <option value="2021">2021年</option>
                        <option value="2022">2022年</option>
                        <option value="2023">2023年</option>
                        <option value="2024">2024年</option>
                        <option value="2025" selected>2025年</option>
                    </select>
                </div>
            </div>
            <div class="filter-actions">
                <button class="query-btn" id="query-data">
                    <i class="fas fa-search"></i> 查询采购数据
                </button>
            </div>
        </div>

        <!-- 数据概览 - 2x2布局 -->
        <div class="data-overview">
            <div class="overview-card">
                <div class="overview-title">采购项目数</div>
                <div class="overview-value">--<span class="overview-unit">项</span></div>
            </div>
            <div class="overview-card">
                <div class="overview-title">采购金额</div>
                <div class="overview-value">--<span class="overview-unit">万元</span></div>
            </div>
            <div class="overview-card">
                <div class="overview-title">概算金额</div>
                <div class="overview-value">--<span class="overview-unit">万元</span></div>
            </div>
            <div class="overview-card">
                <div class="overview-title">节资率</div>
                <div class="overview-value">--<span class="overview-unit">%</span></div>
            </div>
        </div>
    </div>

    <!-- 结果描述 -->
    <div class="result-description" id="result-description">
        请选择筛选条件后点击"查询采购数据"按钮
    </div>

    <!-- 表格区域 -->
    <div class="table-section">
        <!-- 表1：二级单位采购数据 -->
        <div class="table-container">
            <div class="table-header">
                <div class="table-title">2025年二级单位采购数据（万元）</div>
                <div class="table-tabs">
                    <button class="tab-btn active" data-tab="bid">招标采购情况</button>
                    <button class="tab-btn" data-tab="non-bid">非招标情况</button>
                </div>
            </div>
            <table class="data-table" id="procurement-table">
                <thead>
                <tr>
                    <th>二级单位</th>
                    <th>采购金额</th>
                    <th>项目数量</th>
                    <th>平均节资率</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td colspan="4" style="text-align: center;">请先查询数据</td>
                </tr>
                </tbody>
            </table>
        </div>

        <!-- 表2：采购明细数据 -->
        <div class="table-container">
            <div class="table-header">
                <div class="table-title">2025年采购明细数据</div>
            </div>
            <table class="data-table" id="detail-table">
                <thead>
                <tr>
                    <th>采购项目</th>
                    <th>采购单位</th>
                    <th>采购方式</th>
                    <th>金额(万元)</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td colspan="4" style="text-align: center;">请先查询数据</td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    <!-- 图表区域 - 12个图表 -->
    <div class="charts-section">
        <!-- 基础统计图表 -->
        <div class="chart-container">
            <div class="chart-title">近三年采购数据</div>
            <div class="chart-placeholder">近三年采购总额、项目数对比分析</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">连续12个月采购数据</div>
            <div class="chart-placeholder">月度采购金额趋势分析</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">2025年采购方式</div>
            <div class="chart-placeholder">各类采购方式金额分布</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">2025年采购项目</div>
            <div class="chart-placeholder">主要采购品类金额分布</div>
        </div>

        <!-- 采购效率指标图表 -->
        <div class="chart-container">
            <div class="chart-title">招标采购率<br>近三年趋势 + 12个月数据</div>
            <div class="chart-placeholder">招标采购金额占比分析</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">公开招标率<br>近三年趋势 + 12个月数据</div>
            <div class="chart-placeholder">公开招标金额占比分析</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">采购节资率<br>近三年趋势 + 12个月数据</div>
            <div class="chart-placeholder">节资率变化趋势分析</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">全流程线上采购率<br>近三年趋势 + 12个月数据</div>
            <div class="chart-placeholder">线上采购占比分析</div>
        </div>

        <!-- 集采数据图表 -->
        <div class="chart-container">
            <div class="chart-title">一级集采近一年数据</div>
            <div class="chart-placeholder">一级集中采购执行情况</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">二级集采近一年数据</div>
            <div class="chart-placeholder">二级集中采购执行情况</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">华能商城连续12个月采购数据</div>
            <div class="chart-placeholder">商城采购月度趋势</div>
        </div>
        <div class="chart-container">
            <div class="chart-title">框架协议连续12个月采购数据</div>
            <div class="chart-placeholder">框架协议采购执行分析</div>
        </div>
    </div>
</div>

<script>
    // 获取当前日期
    function getCurrentDate() {
        const now = new Date();
        const year = now.getFullYear();
        const month = String(now.getMonth() + 1).padStart(2, '0');
        const day = String(now.getDate()).padStart(2, '0');
        return `${year}-${month}-${day}`;
    }

    // 更新结果描述
    function updateResultDescription() {
        const level = document.getElementById('procurement-level').value || '全部级别';
        const type = document.getElementById('procurement-type').value || '全部类型';
        const enterprise = document.getElementById('enterprise-type').value || '全部类型';
        const platform = document.getElementById('procurement-platform').value || '全部平台';
        const method = document.getElementById('procurement-method').value || '全部方式';
        const year = document.getElementById('year-select').value;

        const description = `截止到${getCurrentDate()}，<span class="highlight">${level}</span>、<span class="highlight">${type}</span>、<span class="highlight">${enterprise}</span>、<span class="highlight">${platform}</span>、<span class="highlight">${method}</span>的${year}年采购数据如下：`;

        document.getElementById('result-description').innerHTML = description;
    }

    // 模拟数据查询
    function queryData() {
        updateResultDescription();

        // 模拟更新概览数据
        const overviewValues = document.querySelectorAll('.overview-value');
        overviewValues[0].innerHTML = '1,248<span class="overview-unit">项</span>';
        overviewValues[1].innerHTML = '8,542.6<span class="overview-unit">万元</span>';
        overviewValues[2].innerHTML = '9,832.1<span class="overview-unit">万元</span>';
        overviewValues[3].innerHTML = '13.1<span class="overview-unit">%</span>';

        // 模拟更新表格数据
        const procurementTable = document.getElementById('procurement-table');
        procurementTable.innerHTML = `
                <thead>
                    <tr>
                        <th>二级单位</th>
                        <th>采购金额</th>
                        <th>项目数量</th>
                        <th>平均节资率</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>华北分公司</td>
                        <td>2,842.5</td>
                        <td>156</td>
                        <td>12.8%</td>
                    </tr>
                    <tr>
                        <td>华东分公司</td>
                        <td>2,156.3</td>
                        <td>132</td>
                        <td>14.2%</td>
                    </tr>
                    <tr>
                        <td>华南分公司</td>
                        <td>1,874.6</td>
                        <td>118</td>
                        <td>11.5%</td>
                    </tr>
                    <tr>
                        <td>西南分公司</td>
                        <td>984.2</td>
                        <td>87</td>
                        <td>13.7%</td>
                    </tr>
                    <tr>
                        <td>西北分公司</td>
                        <td>685.0</td>
                        <td>64</td>
                        <td>10.9%</td>
                    </tr>
                </tbody>
            `;

        // 模拟更新明细表格
        const detailTable = document.getElementById('detail-table');
        detailTable.innerHTML = `
                <thead>
                    <tr>
                        <th>采购项目</th>
                        <th>采购单位</th>
                        <th>采购方式</th>
                        <th>金额(万元)</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>燃煤年度采购</td>
                        <td>华北分公司</td>
                        <td>公开招标</td>
                        <td>1,250.0</td>
                    </tr>
                    <tr>
                        <td>设备配件采购</td>
                        <td>华东分公司</td>
                        <td>竞争性谈判</td>
                        <td>856.3</td>
                    </tr>
                    <tr>
                        <td>化工原料采购</td>
                        <td>华南分公司</td>
                        <td>询价采购</td>
                        <td>642.8</td>
                    </tr>
                    <tr>
                        <td>备品备件采购</td>
                        <td>西南分公司</td>
                        <td>单一来源</td>
                        <td>325.6</td>
                    </tr>
                    <tr>
                        <td>技术服务采购</td>
                        <td>西北分公司</td>
                        <td>邀请招标</td>
                        <td>218.9</td>
                    </tr>
                </tbody>
            `;
    }

    // 标签切换功能
    document.querySelectorAll('.tab-btn').forEach(btn => {
        btn.addEventListener('click', function() {
            // 移除所有active类
            document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
            // 添加active类到当前按钮
            this.classList.add('active');

            // 这里可以添加切换表格内容的逻辑
            const tabType = this.getAttribute('data-tab');
            console.log(`切换到 ${tabType} 数据`);
        });
    });

    // 绑定查询按钮事件
    document.getElementById('query-data').addEventListener('click', queryData);

    // 初始化
    document.getElementById('result-description').textContent = `截止到${getCurrentDate()}，请选择筛选条件后查看年度采购数据`;
</script>
</body>
</html>